﻿@model IEnumerable<Bordspil.Models.Deck>

@{
    ViewBag.Title = "SetCards";
    Layout = "~/Views/Shared/_LayoutForLoggedIn.cshtml";
}

<h2 id="smu">SetCards</h2>
@foreach (var x in Model)
{ 
    <div class="cardSlots">   

        <div class="cardBack">
            <img class="cardBack" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRm9Ze_AJ3G7VHaTihAwThXJY3n-96iiszZsDaQVI472Llkia8p" />
        </div>   
        <div class="cardFront">
            <img class="@x.cardID" src="@x.urlToCard" />
        </div>         
    </div>
}


    <div class="cardSlots">   

        <div class="cardBack">
            <img class="cardBack" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRm9Ze_AJ3G7VHaTihAwThXJY3n-96iiszZsDaQVI472Llkia8p" />
        </div>   
        <div class="cardFront">
            <img class="5" src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Playing_card_spade_5.svg/200px-Playing_card_spade_5.svg.png" />
        </div>         
    </div>


<script>
    $(".cardBack").click(function () {  
        var x = $(this);
        x.hide();
        
        var card1 = x.next().children();
        var card2 = $(".cardBack").click(function () {  
                        var x = $(this);
                        x.hide();
        
                        var card1 = x.next().children();
                        return card1;
        });
        console.log(card1.attr("class"))
        console.log(card2.attr("class"))
        if (card1.attr("class") == card2.attr("class"))
        {
            alert("þú fékkst slag dumm duummm");
        }
      
    });

    $("#smu").click(function () {
        $(".cardBack").show();
    });
</script>



